Ubuntu 16.04
Sponsored Link

OpenStack Mitaka : Use Cinder Storage (Multi-Backend)
2016/06/05
 
It's possible to use Virtual Storages provided by Cinder if an Instance needs more disks.
Configure Virtual storage with NFS and GlusterFS Multi-Backend on here.
                                      +------------------+           +------------------+
                             10.0.0.50| [ Storage Node ] |  10.0.0.61|                  |
+------------------+            +-----+   Cinder-Volume  |     +-----+   GlusterFS #1   |
| [ Control Node ] |            | eth0|                  |     | eth0|                  |
|     Keystone     |10.0.0.30   |     +------------------+     |     +------------------+
|      Glance      |------------+------------------------------+
|     Nova API     |eth0        |     +------------------+     |     +------------------+
|    Cinder API    |            | eth0| [ Compute Node ] |     | eth0|                  |
+------------------+            +-----+   Nova Compute   |     +-----+   GlusterFS #2   |
                             10.0.0.51|                  |  10.0.0.62|                  |
                                      +------------------+     |     +------------------+
                                                               |
                                                               |     +------------------+
                                                               | eth0|                  |
                                                               +-----+        NFS       |
                                                            10.0.0.40|                  |
                                                                     +------------------+
[1]
NFS server is required to be running on your LAN, refer to here.
On this example, configure "/storage" directory on "nfs.srv.world" as a shared directory.
[2]
GlusterFS server is required to be running on your LAN, refer to here.
This example uses a replication volume "vol_replica" provided by "glfs01" and "glfs02".
[3] Configure Storage Node.
root@storage:~#
apt-get -y install nfs-common glusterfs-client
root@storage:~#
vi /etc/cinder/cinder.conf
# add follows in the [DEFAULT] section

enabled_backends = nfs,glusterfs
# add follows to the end

[nfs]
volume_driver = cinder.volume.drivers.nfs.NfsDriver
volume_backend_name = NFS
nfs_shares_config = /etc/cinder/nfs_shares
nfs_mount_point_base = $state_path/mnt_nfs
[glusterfs]
volume_driver = cinder.volume.drivers.glusterfs.GlusterfsDriver
volume_backend_name = GlusterFS
glusterfs_shares_config = /etc/cinder/glusterfs_shares
glusterfs_mount_point_base = $state_path/mnt_glusterfs
root@storage:~#
vi /etc/cinder/nfs_shares
# create new : specify NFS shared directories

nfs.srv.world:/storage
root@storage:~#
vi /etc/cinder/glusterfs_shares
# create new : specify GlusterFS volumes

glfs01.srv.world:/vol_replica
root@storage:~#
chmod 640 /etc/cinder/nfs_shares /etc/cinder/glusterfs_shares

root@storage:~#
chgrp cinder /etc/cinder/nfs_shares /etc/cinder/glusterfs_shares

root@storage:~#
systemctl restart cinder-volume

[4] Configure Compute Node to mount NFS and GlusterFS volumes.
root@node01:~#
apt-get -y install nfs-common glusterfs-client
root@node01:~#
vi /etc/nova/nova.conf
# add follows in the [DEFAULT] section

volume_api_class = nova.volume.cinder.API
root@node01:~#
systemctl restart nova-compute

[5] Create volume types. It's OK to work on any node. (This example is on Control Node)
# set environment variable first

root@dlp ~(keystone)#
echo "export OS_VOLUME_API_VERSION=2" >> ~/keystonerc

root@dlp ~(keystone)#
source ~/keystonerc
root@dlp ~(keystone)#
cinder type-create nfs

+--------------------------------------+------+-------------+-----------+
|                  ID                  | Name | Description | Is_Public |
+--------------------------------------+------+-------------+-----------+
| 4ac6a452-e407-4a1b-a797-df6a96297bcb | nfs  |      -      |    True   |
+--------------------------------------+------+-------------+-----------+

root@dlp ~(keystone)#
cinder type-create glusterfs

+--------------------------------------+-----------+-------------+-----------+
|                  ID                  |    Name   | Description | Is_Public |
+--------------------------------------+-----------+-------------+-----------+
| a5d0912d-e303-4fba-8c30-b6d484f3714f | glusterfs |      -      |    True   |
+--------------------------------------+-----------+-------------+-----------+

root@dlp ~(keystone)#
cinder type-list

+--------------------------------------+-----------+-------------+-----------+
|                  ID                  |    Name   | Description | Is_Public |
+--------------------------------------+-----------+-------------+-----------+
| 4ac6a452-e407-4a1b-a797-df6a96297bcb |    nfs    |      -      |    True   |
| a5d0912d-e303-4fba-8c30-b6d484f3714f | glusterfs |      -      |    True   |
+--------------------------------------+-----------+-------------+-----------+
[6] Associates volume types set in [5] and names set in cinder.conf.
root@dlp ~(keystone)#
cinder type-key nfs set volume_backend_name=NFS

root@dlp ~(keystone)#
cinder type-key glusterfs set volume_backend_name=GlusterFS

root@dlp ~(keystone)#
cinder extra-specs-list

+--------------------------------------+-----------+--------------------------------------+
|                  ID                  |    Name   |             extra_specs              |
+--------------------------------------+-----------+--------------------------------------+
| 4ac6a452-e407-4a1b-a797-df6a96297bcb |    nfs    |    {'volume_backend_name': 'NFS'}    |
| a5d0912d-e303-4fba-8c30-b6d484f3714f | glusterfs | {'volume_backend_name': 'GlusterFS'} |
+--------------------------------------+-----------+--------------------------------------+
[7] Create volumes with specifying volume types.
root@dlp ~(keystone)#
cinder create --display_name disk_nfs --volume-type nfs 10

+--------------------------------+--------------------------------------+
|            Property            |                Value                 |
+--------------------------------+--------------------------------------+
|          attachments           |                  []                  |
|       availability_zone        |                 nova                 |
|            bootable            |                false                 |
|      consistencygroup_id       |                 None                 |
|           created_at           |      2016-06-06T13:05:36.000000      |
|          description           |                 None                 |
|           encrypted            |                False                 |
|               id               | 28839524-63f1-4f52-aba3-ccbbb6188d4a |
|            metadata            |                  {}                  |
|        migration_status        |                 None                 |
|          multiattach           |                False                 |
|              name              |               disk_nfs               |
|     os-vol-host-attr:host      |      network.srv.world@nfs#NFS       |
| os-vol-mig-status-attr:migstat |                 None                 |
| os-vol-mig-status-attr:name_id |                 None                 |
|  os-vol-tenant-attr:tenant_id  |   61bb62a97e394b8db8f95aa05a678771   |
|       replication_status       |               disabled               |
|              size              |                  10                  |
|          snapshot_id           |                 None                 |
|          source_volid          |                 None                 |
|             status             |               creating               |
|           updated_at           |      2016-06-06T13:05:37.000000      |
|            user_id             |   45bb5ebf547f4be2a21bf4a07c83ad85   |
|          volume_type           |                 nfs                  |
+--------------------------------+--------------------------------------+

root@dlp ~(keystone)#
cinder create --display_name disk_glusterfs --volume-type glusterfs 10

+--------------------------------+--------------------------------------+
|            Property            |                Value                 |
+--------------------------------+--------------------------------------+
|          attachments           |                  []                  |
|       availability_zone        |                 nova                 |
|            bootable            |                false                 |
|      consistencygroup_id       |                 None                 |
|           created_at           |      2016-06-06T13:05:52.000000      |
|          description           |                 None                 |
|           encrypted            |                False                 |
|               id               | 01136bbf-a0e6-4ff3-aad0-ab2a302a762b |
|            metadata            |                  {}                  |
|        migration_status        |                 None                 |
|          multiattach           |                False                 |
|              name              |            disk_glusterfs            |
|     os-vol-host-attr:host      |                 None                 |
| os-vol-mig-status-attr:migstat |                 None                 |
| os-vol-mig-status-attr:name_id |                 None                 |
|  os-vol-tenant-attr:tenant_id  |   61bb62a97e394b8db8f95aa05a678771   |
|       replication_status       |               disabled               |
|              size              |                  10                  |
|          snapshot_id           |                 None                 |
|          source_volid          |                 None                 |
|             status             |               creating               |
|           updated_at           |                 None                 |
|            user_id             |   45bb5ebf547f4be2a21bf4a07c83ad85   |
|          volume_type           |              glusterfs               |
+--------------------------------+--------------------------------------+

root@dlp ~(keystone)#
cinder list

+--------------------------------------+-----------+----------------+------+-------------+----------+-------------+
|                  ID                  |   Status  |      Name      | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+----------------+------+-------------+----------+-------------+
| 01136bbf-a0e6-4ff3-aad0-ab2a302a762b | available | disk_glusterfs |  10  |  glusterfs  |  false   |             |
| 28839524-63f1-4f52-aba3-ccbbb6188d4a | available |    disk_nfs    |  10  |     nfs     |  false   |             |
+--------------------------------------+-----------+----------------+------+-------------+----------+-------------+
[8] The Configuration is all OK. Attach volumes to instances like follows.
root@dlp ~(keystone)#
nova list

+--------------------------------------+-------------+---------+------------+-------------+-----------------------------------+
| ID                                   | Name        | Status  | Task State | Power State | Networks                          |
+--------------------------------------+-------------+---------+------------+-------------+-----------------------------------+
| 545457b2-517f-4a3b-bae2-bb99beb8342a | Ubuntu_1604 | SHUTOFF | -          | Shutdown    | int_net=192.168.100.3, 10.0.0.201 |
+--------------------------------------+-------------+---------+------------+-------------+-----------------------------------+

root@dlp ~(keystone)#
nova volume-attach Ubuntu_1604 01136bbf-a0e6-4ff3-aad0-ab2a302a762b auto

+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/vdb                             |
| id       | 01136bbf-a0e6-4ff3-aad0-ab2a302a762b |
| serverId | 545457b2-517f-4a3b-bae2-bb99beb8342a |
| volumeId | 01136bbf-a0e6-4ff3-aad0-ab2a302a762b |
+----------+--------------------------------------+

root@dlp ~(keystone)#
nova volume-attach Ubuntu_1604 28839524-63f1-4f52-aba3-ccbbb6188d4a auto

+----------+--------------------------------------+
| Property | Value                                |
+----------+--------------------------------------+
| device   | /dev/vdc                             |
| id       | 28839524-63f1-4f52-aba3-ccbbb6188d4a |
| serverId | 545457b2-517f-4a3b-bae2-bb99beb8342a |
| volumeId | 28839524-63f1-4f52-aba3-ccbbb6188d4a |
+----------+--------------------------------------+

# the status of attached disk turns "in-use" like follows

root@dlp ~(keystone)#
cinder list

+--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+
|                  ID                  | Status |      Name      | Size | Volume Type | Bootable |             Attached to              |
+--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+
| 01136bbf-a0e6-4ff3-aad0-ab2a302a762b | in-use | disk_glusterfs |  10  |  glusterfs  |  false   | 545457b2-517f-4a3b-bae2-bb99beb8342a |
| 28839524-63f1-4f52-aba3-ccbbb6188d4a | in-use |    disk_nfs    |  10  |     nfs     |  false   | 545457b2-517f-4a3b-bae2-bb99beb8342a |
+--------------------------------------+--------+----------------+------+-------------+----------+--------------------------------------+
 
Tweet